package Thread;
//期望这个类只有唯一实例,单例
//饿汉法
class Singleton{
    private static Singleton instance=new Singleton();


    public static Singleton getsingleton(){
        return instance;
    }
    private  Singleton(){

    }
}
public class Demo17 {
    public static void main(String[] args) {
      Singleton s1=Singleton.getsingleton();
      //Singleton s2=new Singleton();
    }
}
